<?php

namespace app\man\controller;

use think\Controller;
use think\Request;
use think\Db;
use think\Session;

class Common extends Controller
{
	public function  leftmenu()
	{
	}

	public function _initialize()
	{
		$where['username'] = Session::get('username');
		$key = Session::get('kouling');
		$member = Db::name('member')->where($where)->find();
		if(is_null($member)||is_null($key)||md5(md5($member['kouling']))!=$key){
			$this->error('请先登录','/man/site/login',3);
		}
		$this->assign("username",Session::get('username'));
	}

	public function curl_post($data, $url){
		$curl = curl_init();
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_TIMEOUT, 500);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
        $res = curl_exec($curl);
        curl_close($curl);
        return $res;
	}
}